package com.heima.wemedia.service.controller;



import com.heima.model.common.dtos.ResponseResult;
import com.heima.wemedia.service.service.WmNewsService;
import com.heima.wemedia.service.service.WmChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 自媒体频道表(WmChannel)表控制层
 *
 * @author makejava
 * @since 2022-04-12 18:15:06
 */
@RestController
@RequestMapping("/api/v1/channel")
public class WmChannelController {
    /**
     * 服务对象
     */
    @Autowired
    private WmChannelService wmChannelService;

    @Autowired
    private WmNewsService wmNewsService;

    /**
     * 查询所有频道
     * @return
     */
    @GetMapping(path = "/channels")
    public ResponseResult queryAll(){
        return wmChannelService.queryAll();
    }

    /**
     * 根据ID删除文章
     *
     * @param newsId
     * @return
     */
    @GetMapping(path = "del_news/{newsId}")
    public ResponseResult deleteById(@PathVariable("newsId") Long newsId ){
        return wmNewsService.deleteById(newsId);
    }



}

